package com.efuture.chapterthree

/* @Description: 内置函数with的使用 with的作用跟run函数一样 只是写法不同
 * @Auther: zhaoshanshan
 * @Date: 2022/03/06/1:40 下午
 */
fun main() {
    val str = "李元霸"
    val r1 =with(str,::getStrLen);
    val r2 = with(r1,::lenInfo)
    val r3 = with(r2,::getInfoMap)
    val r4 = with(r3, ::println)

}
fun getStrLen(str:String) =  str.length
fun lenInfo(len:Int) = "字符串长度为:$len"
fun getInfoMap(value:String) = "[$value]"

    